//
//  FirstViewController.m
//  Airdrop
//
//  Created by cvicseks-mac1 on 16/2/18.
//  Copyright © 2016年 cvicseks-mac1. All rights reserved.
//

#import "FirstViewController.h"

@interface FirstViewController ()
<
UIImagePickerControllerDelegate,
UINavigationControllerDelegate
>

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIButton *useCamera;
- (IBAction)useCameraAction:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *album;
- (IBAction)Album:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *send;
- (IBAction)sendAction:(id)sender;

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)useCameraAction:(id)sender {
    UIImagePickerController *imagePickerC = [[UIImagePickerController alloc] init];
    imagePickerC.delegate = self;
    imagePickerC.sourceType = UIImagePickerControllerSourceTypeCamera;
//    imagePickerC.mediaTypes =
    [self presentViewController:imagePickerC animated:YES completion:nil];
}
- (IBAction)Album:(id)sender {
    UIImagePickerController *imagePickerC = [[UIImagePickerController alloc] init];
    imagePickerC.delegate = self;
    [self presentViewController:imagePickerC animated:YES completion:nil];
}
- (IBAction)sendAction:(id)sender {
    UIImage *image = self.imageView.image;
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[image] applicationActivities:nil];
    [self presentViewController:activityVC animated:YES completion:nil];
}
@end
